/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package formularios;

import Clases.Conexion;
import java.awt.CardLayout;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperFillManager;
import net.sf.jasperreports.engine.JasperPrint;

/**
 *
 * @author Jrg
 */
public class RptCuentasCobrar extends javax.swing.JInternalFrame {
    public static int IdMenu=9;
    /**
     * Creates new form RptSaldoCuentas
     */
    public RptCuentasCobrar() 
    {
        initComponents();
        CargarReporte();
    }
    
    private void CargarReporte()
    {
        try
        {
            panelReporte.removeAll();
            JRViewer300 Reporte = new JRViewer300(null);
            panelReporte.add(Reporte, "1");
            CardLayout cl = (CardLayout) (panelReporte.getLayout());
            cl.show(panelReporte, "1");
            JasperPrint jv;
            MainMenu.conexion.CrearConexion();
            jv = JasperFillManager.fillReport(MainMenu.pahtReportes + "CuentasPorCobrar.jasper", null,Conexion.conexion);
            Reporte.loadJasperPrint(jv);
            Reporte.setVisible(true);
            MainMenu.conexion.CerrarConexion();
            
        }
        catch(Exception ex)
        {
            JOptionPane.showMessageDialog(null, "Error en carga de datos: " + ex, "Error", JOptionPane.ERROR_MESSAGE);
        }
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        panelReporte = new javax.swing.JPanel();

        setClosable(true);
        setMaximizable(true);
        setResizable(true);
        setTitle("Reporte Cuentas Por Cobrar");
        setToolTipText("");

        panelReporte.setLayout(new java.awt.CardLayout());

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelReporte, javax.swing.GroupLayout.DEFAULT_SIZE, 604, Short.MAX_VALUE)
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(panelReporte, javax.swing.GroupLayout.DEFAULT_SIZE, 287, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel panelReporte;
    // End of variables declaration//GEN-END:variables
}
